<<<<<<< HEAD
"""
乡镇企业利润
"""

import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit

plt.style.use(['grid', 'muted'])

fun = lambda x, a0, a1: a1*x + a0

x0 = np.array([1990, 1991, 1992, 1993, 1994, 1995, 1996])
y0 = np.array([70, 122, 144, 152, 174, 196, 202])

coefficients = np.polyfit(x0, y0, 1)
a1, a0 = coefficients
y1 = fun(x0, a0, a1)

plt.figure(figsize=(8, 6))
plt.plot(x0, y0, '*', label='original values')
plt.plot(x0, y1, 'r--', label='poly_fit values')

plt.xlabel('x axis')
plt.ylabel('y axis')
plt.legend(loc="lower right")
plt.title('Poly Fitting (y={:.3f}x+{:.3f})'.format(a1, a0))
=======
"""
乡镇企业利润
"""

import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit

plt.style.use(['grid', 'muted'])

fun = lambda x, a0, a1: a1*x + a0

x0 = np.array([1990, 1991, 1992, 1993, 1994, 1995, 1996])
y0 = np.array([70, 122, 144, 152, 174, 196, 202])

coefficients = np.polyfit(x0, y0, 1)
a1, a0 = coefficients
y1 = fun(x0, a0, a1)

plt.figure(figsize=(8, 6))
plt.plot(x0, y0, '*', label='original values')
plt.plot(x0, y1, 'r--', label='poly_fit values')

plt.xlabel('x axis')
plt.ylabel('y axis')
plt.legend(loc="lower right")
plt.title('Poly Fitting (y={:.3f}x+{:.3f})'.format(a1, a0))
>>>>>>> a66c8eec2c3bbe955d7da215f43ffffda9c7b6b5
plt.show()